from datetime import datetime
from typing import Optional
from pydantic import BaseModel


class SignParamBody(BaseModel):
    """签名请求报文体"""
    secret_key: str
    private_key: str
    public_key: str
    params: Optional[dict | str]
    #signature: Optional[str] = None

class VerifyParamBody(BaseModel):
    """验签请求报文体"""
    secret_key: str
    public_key: str
    params: Optional[dict | str]
    signature: str


class DemoPostBase(BaseModel):
    title: str
    content: str

class DemoPost(DemoPostBase):
    id: int
    create_by: Optional[str]
    update_by: Optional[str]
    create_time: Optional[datetime]
    update_time: Optional[datetime]


class ItemBase(BaseModel):
    title: str
    description: str | None = None


class ItemCreate(ItemBase):
    pass


class Item(ItemBase):
    id: int
    owner_id: int

    class Config:
        orm_mode = True


class UserBase(BaseModel):
    email: str


class UserCreate(UserBase):
    password: str


class User(UserBase):
    id: int
    is_active: bool
    items: list[Item] = []

    class Config:
        orm_mode = True